package com.wushijia.mq;

/*import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;

import javax.jms.*;*/

public class JMSCustmer {

  /*private static final String USERNAME = ActiveMQConnection.DEFAULT_USER;
  private static final String PASSWORD = ActiveMQConnection.DEFAULT_PASSWORD;
  private static final String BROKEURL = ActiveMQConnection.DEFAULT_BROKER_URL;

  public static void main(String[] args) {
    ConnectionFactory connectionFactory;
    Connection connection;
    Session session;
    Destination destination;
    MessageConsumer messageConsumer;

    connectionFactory = new ActiveMQConnectionFactory(JMSCustmer.USERNAME, JMSCustmer.PASSWORD, JMSCustmer.BROKEURL);
    try {
      connection = connectionFactory.createConnection();
      connection.start();
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      //创建一个连接helloworld的消息队列
      destination = session.createQueue("helloworld");
      messageConsumer = session.createConsumer(destination);
      while (true) {
        TextMessage message = (TextMessage) messageConsumer.receive(100000);
        if (message != null) {
          System.out.println("收到的消息：" + message.getText());
        } else {
          break;
        }

      }
    } catch (JMSException e) {
      e.printStackTrace();
    }
  }*/

}
